<template>
	<!-- 视频 短讯 -->
	<view style="box-sizing: border-box; padding: 10px; background: #fff; margin-bottom: 10px;">
		<!-- <view style="display: flex; border-bottom: #eee solid 1px; padding-bottom: 8px;">
			<view>
				<u-avatar style="vertical-align: -19px; margin-right: 10px;" src="http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg"></u-avatar>
				小盆友
			</view>
			<view style="margin-left: auto;">
				<view style="width: 100px; margin-top: 8px; background: #FA9700; color: #fff; text-align: center; line-height: 36px; height: 36px; border-radius: 30px;">
					+关注
				</view>
			</view>
		</view> -->
		<navigator  style="background: #fff;"  class="item"  hover-class="none">
			<view class="title" style="line-height: 46px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">
			<!-- <span style="border-radius: 8px; border: #EA9B37 solid 1px; color: #EA9B37; padding: 4px 8px; font-size: 12px; margin-right: 6px;">置顶</span> -->
			{{articleInfo.title}}
			</view>
			<view style="width: 100%; height: 140px; overflow: hidden; border-radius: 6px;">
				<image v-for="(items,indexs) in articleInfo.images" style="width: 100%;" :src="items" mode="widthFix"></image>
			</view>
			<view style="padding: 10px 0;">
				<rich-text :nodes="articleInfo.content"></rich-text>
			</view>
			<view class="line"></view>
		</navigator>
		<view style="line-height: 30px;">
			<image style="width: 12px; vertical-align: -2px; margin-right: 10px; height: 16px;" src="/static/1.png"></image> 活动类型：{{articleInfo.activity_type}}
		</view>
		<view style="line-height: 30px;">
			<image style="width: 12px; vertical-align: -2px; margin-right: 10px; height: 12px;" src="/static/2(1).png"></image>活动时间：{{articleInfo.activity_time}}
		</view>
		<view style="line-height: 30px;">
			<image style="width: 12px; vertical-align: -2px; margin-right: 10px; height: 16px;" src="/static/3(1).png"></image>活动地点：{{articleInfo.activity_place}}
		</view>
		<!-- <view style="display: flex; align-items: center; line-height: 40px; justify-content: center;">
			<view style="width: 25%; text-align: center;">
				<image style="width: 22px; height: 16px; margin-right: 8px; vertical-align: -3px;" src="/static/x1.png"></image>
				1200
			</view>
			<view style="width: 25%; text-align: center;">
				<image style="width: 14px; height: 14px; margin-right: 8px; vertical-align: -3px;" src="/static/x2.png"></image>
				1200
			</view>
			<view style="width: 25%; text-align: center;">
				<image style="width: 14px; height: 14px; margin-right: 8px; vertical-align: -3px;" src="/static/x3.png"></image>
				1200
			</view>
			<view style="width: 25%; text-align: center;">
				<image style="width: 14px; height: 14px; margin-right: 8px; vertical-align: -3px;" src="/static/x4.png"></image>
				1200
			</view>
		</view> -->
		<view style="height: 66px;"></view>
		<view style="width: 95%; margin: auto; border-radius: 30px; background: #FA9700; color: #fff; line-height: 46px; text-align: center; position: absolute; z-index: 1; bottom: 20px; left: 2.5%;" @click="goBao">
			{{articleInfo.is_apply==0?'立即报名':'报名成功'}}
		</view>
	</view>
</template>

<script>
	import {homeDetail,applyActivity,createActivityOrder} from "@/common/config/request.js"
	export default {
		data() {
			return {
				articleInfo:"",
				id:"",
			}
		},
	    onLoad(option) {
			this.id=option.id
	    },
		onShow() {
			this.getHomeDetail()
		},
		methods: {
			getHomeDetail(id){
				var data={
					id:this.id
				}
				homeDetail(data).then((res)=>{
					console.log(res,'文章详情')
					if(res.data.code==1){
						this.articleInfo=res.data.data
					}
				})
			},
			// 活动报名
			goBao(){
				console.log(this.articleInfo.activity_price)
				if(Number(this.articleInfo.activity_price)>0){
					createActivityOrder({push_id:this.articleInfo.id}).then(res=>{
						// console.log(res)
						if(res.data.code==1){
							uni.navigateTo({
								url:'/pages/article/payHuo?price='+this.articleInfo.activity_price+'&orderId='+res.data.data.order_no+"&id="+this.articleInfo.id
							})
						}
					})
				}else{
					var data={
						push_id:this.articleInfo.id
					}
					if(this.articleInfo.is_apply==0){
						applyActivity(data).then((res)=>{
							// console.log(res,'33222')
							if(res.data.code==1){
								uni.showToast({
									icon:'none',
									title:'报名成功'
								})
								this.articleInfo.is_apply=1
							}
						})
					}
				}
			}
		}
	}
</script>

<style>

</style>
<style lang="scss">
	page{background: #f0f0f0;}
/*文章列表*/
.list {
	margin-top: 2rpx;
	.item {
		padding: 40rpx 24rpx 0 24rpx;
		.info {
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			padding-bottom: 4rpx;
			.text {
				flex-grow: 1;
				flex-shrink: 1;
				display: flex;
				flex-direction: column;
				margin-right: 40rpx;
				.title {
					flex-grow: 1;
					flex-shrink: 1;
					font-size: 34rpx;
					line-height: 1.5;
					display: -webkit-box;
					text-overflow: ellipsis;
					word-break: break-all;
					-webkit-line-clamp: 2;
					-webkit-box-orient: vertical;
					overflow: hidden;
					height: 72rpx;
					margin-bottom: 8rpx;
				}
				.other {
					flex-grow: 1;
					flex-shrink: 1;
					display: flex;
					align-items: center;
					font-size: 28rpx;
					color: #999;
					line-height: normal;
					.left {
						display: flex;
						flex-grow: 1;
						flex-shrink: 1;
						.source {
							display: -webkit-box;
							text-overflow: ellipsis;
							word-break: break-all;
							-webkit-line-clamp: 1;
							-webkit-box-orient: vertical;
							overflow: hidden;
							width: 140rpx;
							margin-right: 16rpx;
						}
					}
					.right {
						display: flex;
						flex-direction: row;
						justify-content: center;
						align-items: center;
						flex-grow: 0;
						flex-shrink: 0;
						margin-right: 5rpx;
						image {
							flex-grow: 1;
							flex-shrink: 1;
							width: 28rpx;
							height: 28rpx;
							margin-right: 12rpx;
						}
						text {
							flex-grow: 1;
							flex-shrink: 1;
							margin-top: -6rpx;
						}
					}
					.view {
						image {
							width: 40rpx;
							height: 40rpx;
							margin-right: 5rpx;
						}
					}
					
					// .listboxlist{
						
					// }
				}
			}
			.photo {
				image {
					height: 170rpx;
					width: 222rpx;
					border-radius: 10rpx;
				}
			}
		}
		.line {
			display: bock;
			width: 100%;
			height: 1rpx;
			margin-top: 22rpx;
			background: #e8e8e8;
		}
		&:last-child {
			.line {
				//display: none;
			}
			//padding-bottom: 30rpx;
		}
	}
}
</style>
